﻿import flash.geom.Rectangle;
/**
 * ...
 * @author	Kliment
 * @version	1.2.0
 */
class kliment.geom.BoundsRectangle {
	public var xMin:Number = 0;
	public var yMin:Number = 0;
	public var xMax:Number = 0;
	public var yMax:Number = 0;
	
	public function BoundsRectangle(xMin:Number, yMin:Number, xMax:Number, yMax:Number) {
		this.xMin = xMin;
		this.yMin = yMin;
		this.xMax = xMax;
		this.yMax = yMax;
	}
	
	public function get width():Number { return xMax - xMin }
	
	public function get height():Number { return yMax - yMin }
	
	public function toRectangle():Rectangle {
		return new Rectangle(xMin, yMin, width, height);
	}
	
	public function includePoint(point:Object):Boolean {
		if (point.x >= xMin && point.x <= xMax && point.y >= yMin && point.y <= yMax) 
			return true;
		return false;
	}
	
	public function toString():String {
		return '(xMin=' + xMin + ', xMax=' + xMax + ', yMin=' + yMin + ', yMax=' + yMax + ')';
	}
}